<!DOCTYPE HTML>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="container">
<!-- Focusable elements -->
<a id="anchor" href="tabindex-defaults.html">anchor</a>
<button id="button">button</button>
<input id="input">
<select id="select"></select>
<textarea id="textarea"></textarea>
<div id="editableDiv" contenteditable="true"></div>

<!-- Unfocusable element -->
<div id="normalDiv"></div>
</div>

<script>
description('Default value of tabIndex IDL attribute');

var anchor = document.getElementById('anchor');
var button = document.getElementById('button');
var input = document.getElementById('input');
var select = document.getElementById('select');
var textarea = document.getElementById('textarea');
var editableDiv = document.getElementById('editableDiv');
var normalDiv = document.getElementById('normalDiv');

shouldBe('anchor.tabIndex', '0');
shouldBe('button.tabIndex', '0');
shouldBe('input.tabIndex', '0');
shouldBe('select.tabIndex', '0');
shouldBe('textarea.tabIndex', '0');
shouldBe('editableDiv.tabIndex', '0');
shouldBe('normalDiv.tabIndex', '-1');

shouldBe('anchor.setAttribute("tabindex", "invalid"); anchor.tabIndex', '0');
shouldBe('button.setAttribute("tabindex", "invalid"); button.tabIndex', '0');
shouldBe('input.setAttribute("tabindex", "invalid"); input.tabIndex', '0');
shouldBe('select.setAttribute("tabindex", "invalid"); select.tabIndex', '0');
shouldBe('textarea.setAttribute("tabindex", "invalid"); textarea.tabIndex', '0');
shouldBe('editableDiv.setAttribute("tabindex", "invalid"); editableDiv.tabIndex', '0');
shouldBe('normalDiv.setAttribute("tabindex", "invalid"); normalDiv.tabIndex', '-1');

shouldBe('anchor.setAttribute("tabindex", "9999999999"); anchor.tabIndex', '0');
shouldBe('button.setAttribute("tabindex", "9999999999"); button.tabIndex', '0');
shouldBe('input.setAttribute("tabindex", "9999999999"); input.tabIndex', '0');
shouldBe('select.setAttribute("tabindex", "9999999999"); select.tabIndex', '0');
shouldBe('textarea.setAttribute("tabindex", "9999999999"); textarea.tabIndex', '0');
shouldBe('editableDiv.setAttribute("tabindex", "9999999999"); editableDiv.tabIndex', '0');
shouldBe('normalDiv.setAttribute("tabindex", "9999999999"); normalDiv.tabIndex', '-1');

document.getElementById('container').innerHTML = '';
</script>
</body>
</html>
